#include "jcrsubwindow.h"
#include "abstractview.h"

namespace Jcr
{

class JcrSubWindowPrivate
{
public:
    AbstractView* view = nullptr;
};

JcrSubWindow::JcrSubWindow(QWidget* parent) : QMdiSubWindow(parent)
{
    d_ptr = new JcrSubWindowPrivate;
}

JcrSubWindow::~JcrSubWindow()
{
    delete d_ptr;
}

AbstractView* JcrSubWindow::view() const
{
    return d_ptr->view;
}

void JcrSubWindow::setView(AbstractView *view)
{
    if (d_ptr->view != view) {
        AbstractView* oldView = d_ptr->view;
        d_ptr->view = view;
        emit viewChanged(oldView, view);
        setWidget(view);
    }
}

}
